]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell: Fix pixbuf reference leak saving screenshots
authorDmitrii Naidolinskii <horisontdawn@yandex.ru>
Sun, 28 Aug 2022 11:37:54 +0000 (16:37 +0500)
committerDmitrii Naidolinskii <horisontdawn@yandex.ru>
Sun, 28 Aug 2022 11:37:54 +0000 (16:37 +0500)
When saving a screenshot, the GdkPixbuf created would be left
with a dangling reference after saving to disk (either leaked
on errors, or via an extra reference on success). Always unref
the pixbuf so it's either destroyed on error or there is a single
reference fully transferred to the caller of the function.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5501
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2449>

src/shell-screenshot.c

index fcf2da2365e7437d5b51cb6c9d7f8cd51e22d331..c173dd5d8e83e64ca94c9471a5d4c2510f6d449b 100644 (file)
@@ -1061,6 +1061,7 @@ composite_to_stream_on_png_saved (GObject      *pixbuf,
   else
     g_task_return_pointer (task, g_object_ref (pixbuf), g_object_unref);
 
+  g_object_unref (pixbuf);
   g_object_unref (task);
 }